package weibo4j.examples.account;

import weibo4j.Account;
import weibo4j.Weibo;
import weibo4j.http.HttpClient;
import weibo4j.model.PostParameter;
import weibo4j.model.Status;
import weibo4j.model.WeiboException;
import weibo4j.org.json.JSONException;
import weibo4j.org.json.JSONObject;

public class GetUid {

	/**
	 * @param args
	 * @throws JSONException 
	 */
	public static void main(String[] args) throws JSONException {
		Weibo weibo = new Weibo();
		String access_token = args[0];
		weibo.setToken(access_token);
		Account am = new Account();
		PostParameter token = new PostParameter("access_token", access_token);
		PostParameter status = new PostParameter("status", "second test");
		PostParameter[] params = {token, status};

		try {
			JSONObject json = am.getUid();
			System.out.println(json.toString());
			HttpClient client = weibo.client;
			client.post("https://api.weibo.com/2/statuses/update.json", params);
		} catch (WeiboException e) {
			e.printStackTrace();
		}
	}

}
